package ru.study.thinkin.chapter13.packageaccess;

import ru.study.thinkin.chapter13.*;

import java.lang.reflect.*;

public class HiddenImplementation {
	
	private static void callHiddenMethod(A a, String methodName) throws Exception{		
		Method m = a.getClass().getDeclaredMethod(methodName);
		
		m.setAccessible(true);
		m.invoke(a);
	}

	
	public static void main(String[] args) throws Exception {
		A a = HiddenC.makeA();
		a.f();
//		C c = (C) a;
		callHiddenMethod(a,"g");		
		callHiddenMethod(a,"w");	
		
	}	
}
//для примера из пакета thinkin.tests
class InnerImplementation  {
	private int sum = 555;
	
	private void printSum(){
		System.out.println("=="+sum);
	}
}